import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import deno from "@deno/vite-plugin";
import { resolve } from "node:path";

import "react";
import "react-dom";

export default defineConfig({
  root: "./client",
  server: {
    port: 23924,
    proxy: {
      '/api': {
        target: 'http://localhost:23925',
        changeOrigin: true,
      }
    }
  },
  plugins: [
    react(),
    deno(),
  ],
  resolve: {
    alias: {
      'd8d-manage-react': resolve(__dirname, './jsr/d8d-manage-react/mod.ts')
    }
  },
  optimizeDeps: {
    include: ["react/jsx-runtime"],
    exclude: ["d8d-manage-react"]
  },
});
